package org.wishwork.api;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

/**
 * @description: 基础DTO
 * @author: WangYX
 * @create: 2022-02-15 11:18
 * @Version: 1.0.0
 **/
@EqualsAndHashCode
@Getter
@ToString
public abstract class Base {

    /**
     * 第几页
     */
    protected Integer pageIndex;

    /**
     * 每页记录数
     */
    protected Integer pageSize;

    protected Base(Integer pageIndex, Integer pageSize) {
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
    }

    public abstract <T extends Builder> T toBuilder();

    protected static abstract class Builder<T extends Builder, R extends Base> {

        protected Integer pageIndex;
        protected Integer pageSize;

        public abstract T pageIndex(Integer pageIndex);

        public abstract T pageSize(Integer pageSize);

        public abstract R build();
    }

}
